/**
 * Copyright &copy; 2013-2015 山东易科德软件有限公司   All rights reserved.
 */
package cn.net.ecode.modules.sys.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.net.ecode.common.persistence.Page;
import cn.net.ecode.common.service.CrudService;
import cn.net.ecode.modules.sys.dao.PostDao;
import cn.net.ecode.modules.sys.entity.Employee;
import cn.net.ecode.modules.sys.entity.Post;

/**
 * 岗位管理Service
 * @author 冯伟、ThinkGem
 * @version 2015-7-29
 */
@Service
@Transactional(readOnly = true)
public class PostService extends CrudService<PostDao, Post> {

	/**
	 * 查询岗位
	 * @param post
	 * @return
	 */
	public Post get(String postCode) {
		return super.get(postCode);
	}
	
	/**
	 * 根据名称查询岗位
	 * @param post
	 * @return
	 */
	public Post getByName(String postName) {
		Post post = new Post();
		post.setPostName(postName);
		return dao.getByName(post);
	}

	/**
	 * 查询岗位列表
	 */
	public List<Post> findList(Post post) {
		return super.findList(post);
	}

	/**
	 * 查询可分页的岗位列表
	 */
	public Page<Post> findPage(Page<Post> page, Post post) {
		return super.findPage(page, post);
	}

	/**
	 * 保存岗位
	 */
	@Transactional(readOnly = false)
	public void save(Post post) {
		super.save(post);
	}

	/**
	 * 删除岗位
	 */
	@Transactional(readOnly = false)
	public void delete(Post post) {
		super.delete(post);
	}

	/**
	 * 禁用岗位
	 */
	@Transactional(readOnly = false)
	public void disable(Post post) {
		dao.disable(post);
	}

	/**
	 * 启用岗位
	 */
	@Transactional(readOnly = false)
	public void enable(Post post) {
		dao.enable(post);
	}
	
	/**
	 * 根据用户查询岗位
	 * @param employee
	 * @return
	 */
	public List<Post> getPostByEmployee(Employee employee){
		return dao.getPostByEmployee(employee);
	}

}